<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<%@ include file="/view/common/init.jsp"%>
<title>Quản lý group</title>
<s:form action="list.do" method="get" name="groupListForm">
<center>
	<div class="header">QUẢN LÝ GROUP</div>
	<div style="width: 980px;margin-top: 80px;">
		<div style="width: 100%;margin-bottom: 10px;">
			<button type="button" onclick="location.href='<c:out value="${pageContext.request.contextPath}"/>/group/add.do'" style="float: right;">Thêm group</button>
			<div class="clear-right"><span></span></div>
		</div>  	
		<c:if test='${end != "0"}'> 
		<div style="width: 100%;margin-bottom: 10px;text-align: right;">
			<c:choose>  
				<c:when test='${start != end}'>  
					Bản ghi thứ <c:out value="${start}"/> đến <c:out value="${end}"/>&nbsp;
				</c:when>  
				<c:otherwise>  
					Bản ghi thứ <c:out value="${start}"/>&nbsp;
				</c:otherwise> 
			</c:choose>	 
			trong tổng số <c:out value="${total}"/> bản ghi &nbsp;&nbsp;&nbsp;
			<c:if test='${page != "1"}'> 
				<input type="image" onclick="$('page').value=parseInt($('page').value)-1;return true;" src="<c:out value="${pageContext.request.contextPath}"/>/image/first.png">&nbsp;&nbsp;
			</c:if>
			<c:if test='${pageNum != 1}'>
				<input id="page" readonly="readonly" type="text" name="page" style="width: 30px;text-align: center;" value="<c:out value="${page}"/>">&nbsp;&nbsp;
			</c:if>			
			<c:if test='${page != pageNum}'> 
				<input type="image" onclick="$('page').value=parseInt($('page').value)+1;return true;"  src="<c:out value="${pageContext.request.contextPath}"/>/image/last.png">
			</c:if>
		</div>		
		</c:if>
		<table class="tbl_info" style="width: 980px;">
        <tbody><tr>
          <td class="hed">STT</td>
          <td class="hed">Group ID</td>
          <td class="hed">Tên group</td>
          <td class="hed"> </td>
          <td class="hed">Sửa</td>
          <td class="hed">Xóa</td>
        </tr>
      
 	<c:forEach var="group" items="${groups}" varStatus="rowCounter">
		<tr>
			<td><c:out value="${group.index}" /></td>
			<td><c:out value="${group.groupId}" /></td>
			<td><c:out value="${group.groupName}" /></td>
			<td><a href="<c:out value="${pageContext.request.contextPath}"/>/group/view.do?group.groupId=<c:out value="${group.groupId}"/>">
				Chi_tiết
			</a></td>
			<td><a class="pic_link" href="<c:out value="${pageContext.request.contextPath}"/>/group/edit.do?group.groupId=<c:out value="${group.groupId}"/>">
			 	<img alt="" src="<c:out value="${pageContext.request.contextPath}"/>/image/b_edit.png" title="Sửa group"/>
			 </a></td>
			 <td><a class="pic_link" href="#" onclick="deleteGroup(<c:out value="${group.groupId}"/>);">
			 	<img alt="" src="<c:out value="${pageContext.request.contextPath}"/>/image/b_drop.png" title="Xóa group"/>
			 </a></td>
		</tr>      		
	</c:forEach>
      </tbody></table>
 </div>
</center>
</s:form>